Jenkins can't find Java after update. Running on CentOS 7

Maybe two months ago I installed the latest Jenkins on CentOS 7 following the instructions here, which includes installing Java OpenJDK 11. Linux

This was successful and I was able to run Jenkins and set up a single project. A month later I saw that an update was available for Jenkins, so I went through the process of installing the latest. Possibly I did something wrong here as I simply ran the command to install Jenkins again rather than update??? At any rate, it seemed successful, but then wouldn’t start. In short, it doesn’t seem to recognize Java anymore. All the answers I see on this appear to be out of date, for example, to edit /etc/init.d/jenkins and add java path. How do I verify/fix the Java path for the latest version of Jenkins on CentOS 7?

**sudo systemctl start jenkins**
Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.

**sudo systemctl status jenkins**
â—Ź jenkins.service - Jenkins Continuous Integration Server
   Loaded: loaded (/usr/lib/systemd/system/jenkins.service; enabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Thu 2022-09-01 15:25:36 PDT; 5min ago
 Main PID: 4512 (code=exited, status=1/FAILURE)
 systemd[1]: jenkins.service: main process exited, code=exited, status=1/FAILURE
 systemd[1]: Failed to start Jenkins Continuous Integration Server.
 systemd[1]: Unit jenkins.service entered failed state.
 systemd[1]: jenkins.service failed.
 systemd[1]: jenkins.service holdoff time over, scheduling restart.
 systemd[1]: Stopped Jenkins Continuous Integration Server.
 systemd[1]: start request repeated too quickly for jenkins.service
 systemd[1]: Failed to start Jenkins Continuous Integration Server.
 systemd[1]: Unit jenkins.service entered failed state.
 systemd[1]: jenkins.service failed.

**sudo journalctl -xe**
-- Unit jenkins.service has begun starting up.
 systemd[1]: jenkins.service: main process exited, code=exited, status=1/FAILURE
 jenkins[7170]: jenkins: failed to find a valid Java installation
 systemd[1]: Failed to start Jenkins Continuous Integration Server.
-- Subject: Unit jenkins.service has failed

Does /usr/bin/java or similar exist?

1 Like

Yes, though that is just a link to /etc/alternatives/java

Hi there,

Jenkins 2.332.1 switched Jenkins from using System V init to use systemd with its Linux package installers for Debian, Ubuntu, Red Hat, Alma, openSUSE, Rocky, and more. The LTS Upgrade Guide describes that transition and how to adapt your environment to the transition.

There is a blog post about it as well at

There is also a video introduction for RPM based distributions like Red Hat Enterprise Linux, Alma Linux, Rocky Linux, Oracle Linux, and Amazon Linux.

There is also a video introduction for deb based distributions like Debian and Ubuntu

1 Like

Well, I never thought to check the Java install because I hadn’t touched it (that I recall), but it ends up the symlinks for java were messed up and I just had to fix that. Once done, Jenkins started up fine. Thanks for the responses!